package 剑指offer;

import java.util.HashMap;
import java.util.HashSet;

/**
 * A6
 */
public class A6 {

    public int[] twoSum(int[] numbers, int target) {
        HashMap<Integer,Integer> data=new HashMap<>();
        for (int i = 0; i < numbers.length; i++) {
            if (data.containsKey(numbers[i])) {
                return new int[]{data.get(numbers[i]),i};
            }
            data.put(target-numbers[i], i);
        }
        return null;
    }
}